:root {
  --mixedbread-border-color: var(--sl-color-gray-5);
  --mixedbread-bg-primary: var(--sl-color-black);
  --mixedbread-text-primary: var(--sl-color-white);
  --mixedbread-text-muted: var(--sl-color-gray-3);
  --mixedbread-border-radius: 0.375rem;
  --mixedbread-transition: all 0.15s ease;
}

.mixedbread-search-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  background-color: transparent;
  color: var(--sl-color-gray-1);
  cursor: pointer;
  height: 2.5rem;
  font-size: var(--sl-text-xl);
}

.mixedbread-button-container {
  display: contents;
}

.mixedbread-search-icon {
  width: 0.875em;
  height: 0.875em;
  stroke-width: 0.125rem;
}

.mixedbread-button-placeholder,
.mixedbread-button-kbd {
  display: none;
}

.mixedbread-button-kbd kbd {
  display: inline-block;
  padding: 0.125em 0.375em;
  font-size: 0.875em;
  line-height: 1;
  color: var(--sl-color-gray-1);
  background: var(--sl-color-gray-6);
  border: 1px solid var(--sl-color-gray-5);
  border-radius: 0.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@media (min-width: 50rem) {
  .mixedbread-search-button {
    border: 1px solid var(--mixedbread-border-color);
    border-radius: var(--mixedbread-border-radius);
    padding-inline-start: 0.75rem;
    padding-inline-end: 0.5rem;
    background-color: var(--mixedbread-bg-primary);
    color: var(--sl-color-gray-2);
    font-size: var(--sl-text-sm);
    width: 100%;
    max-width: 22rem;
    transition: var(--mixedbread-transition);
  }

  .mixedbread-search-button:hover {
    border-color: var(--sl-color-gray-2);
    color: var(--mixedbread-text-primary);
    box-shadow: 0 0 0 1px var(--sl-color-gray-2);
  }

  .mixedbread-button-placeholder,
  .mixedbread-button-kbd {
    display: flex;
    align-items: center;
  }

  .mixedbread-button-kbd {
    display: flex;
    gap: 0.25em;
    margin-inline-start: auto;
  }
}

.mixedbread-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.15s ease,
    visibility 0.15s ease;
}

.mixedbread-modal.is-open {
  visibility: visible;
  opacity: 1;
}

.mixedbread-modal-container {
  background: var(--mixedbread-bg-primary);
  border: 1px solid var(--mixedbread-border-color);
  border-radius: 0.5rem;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 640px;
  max-height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.15s ease;
}

.mixedbread-modal.is-open .mixedbread-modal-container {
  transform: translateY(0);
}

.mixedbread-searchbox {
  padding: 0;
  border-bottom: 1px solid var(--mixedbread-border-color);
  position: relative;
}

.mixedbread-searchbox::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
  opacity: 0.5;
  pointer-events: none;
}

.mixedbread-searchbox input {
  width: 100%;
  padding: 14px 96px 14px 48px;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--sl-color-white);
  outline: none;
  font-family: inherit;
}

.mixedbread-searchbox input::-webkit-search-cancel-button,
.mixedbread-searchbox input::-webkit-search-decoration,
.mixedbread-searchbox input::-webkit-search-results-button,
.mixedbread-searchbox input::-webkit-search-results-decoration {
  display: none;
}

.mixedbread-searchbox input::-ms-clear,
.mixedbread-searchbox input::-ms-reveal {
  display: none;
}

.mixedbread-searchbox input::placeholder {
  color: var(--sl-color-gray-3);
}

.mixedbread-clear {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: none;
  color: var(--sl-color-gray-3);
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.15s ease,
    color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mixedbread-clear.show {
  opacity: 1;
}

.mixedbread-clear:hover {
  color: var(--sl-color-gray-1);
}

.mixedbread-clear:focus {
  outline-offset: 2px;
  border-radius: 4px;
}

.mixedbread-clear svg {
  width: 16px;
  height: 16px;
}

.mixedbread-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: var(--sl-color-gray-6);
  color: var(--sl-color-gray-2);
  cursor: pointer;
  border-radius: 6px;
  transition:
    opacity 0.15s ease,
    color 0.15s ease,
    background-color 0.15s ease;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.mixedbread-close:hover {
  color: var(--sl-color-white);
  background: var(--sl-color-gray-5);
}

.mixedbread-close:focus {
  outline-offset: 2px;
}

.mixedbread-close svg {
  width: 20px;
  height: 20px;
}

.mixedbread-results {
  background: var(--sl-color-gray-6);
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  overscroll-behavior: contain;
}

.mixedbread-results > * + * {
  margin-top: 16px;
}

.mixedbread-results > .mixedbread__results:first-of-type {
  margin-top: 0;
}

.mixedbread-results::-webkit-scrollbar {
  width: 8px;
}

.mixedbread-results::-webkit-scrollbar-track {
  background: transparent;
}

.mixedbread-results::-webkit-scrollbar-thumb {
  background: var(--sl-color-gray-5);
  border-radius: 4px;
}

.mixedbread-results::-webkit-scrollbar-thumb:hover {
  background: var(--sl-color-gray-4);
}

.mixedbread__results {
  padding: 0;
  margin: 0;
  list-style: none;
}

.mixedbread__result {
  display: flex;
  align-items: flex-start;
  border: 0;
  padding: 0;
  list-style-type: none;
  margin-bottom: 12px;
}

.mixedbread__result:last-child {
  margin-bottom: 0;
}

.mixedbread__result-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
  gap: 1px;
}

.mixedbread__result-inner > :first-child {
  border-radius: 4px 4px 0 0;
}

.mixedbread__result-inner > :last-child {
  border-radius: 0 0 4px 4px;
}

.mixedbread__result-inner > :only-child {
  border-radius: 4px;
}

.mixedbread__result-link {
  position: relative;
  display: block;
  padding: 10px 16px 10px 48px;
  background-color: var(--sl-color-black);
  border-radius: 6px;
  color: var(--sl-color-white);
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
  outline: none;
  border: 1px solid transparent;
}

.mixedbread__result-link:hover {
  border-color: var(--sl-color-accent-high);
}

.mixedbread__result-link:focus,
.mixedbread__result-link:focus-visible {
  border-color: var(--sl-color-accent-high);
  background: color-mix(in srgb, var(--sl-color-accent) 5%, transparent);
  outline: none;
}

.mixedbread__result-page::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 12px;
  width: 24px;
  background: var(--sl-color-gray-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M9 10h1a1 1 0 1 0 0-2H9a1 1 0 0 0 0 2Zm0 2a1 1 0 0 0 0 2h6a1 1 0 0 0 0-2H9Zm11-3V8l-6-6a1 1 0 0 0-1 0H7a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3V9Zm-6-4 3 3h-2a1 1 0 0 1-1-1V5Zm4 14a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h5v3a3 3 0 0 0 3 3h3v9Zm-3-3H9a1 1 0 0 0 0 2h6a1 1 0 0 0 0-2Z'/%3E%3C/svg%3E")
    center no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M9 10h1a1 1 0 1 0 0-2H9a1 1 0 0 0 0 2Zm0 2a1 1 0 0 0 0 2h6a1 1 0 0 0 0-2H9Zm11-3V8l-6-6a1 1 0 0 0-1 0H7a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3V9Zm-6-4 3 3h-2a1 1 0 0 1-1-1V5Zm4 14a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h5v3a3 3 0 0 0 3 3h3v9Zm-3-3H9a1 1 0 0 0 0 2h6a1 1 0 0 0 0-2Z'/%3E%3C/svg%3E")
    center no-repeat;
}

.mixedbread__result-title {
  display: block;
  margin: 0 0 4px 0;
  color: inherit;
  font-weight: 600;
}

.mixedbread__result-description {
  display: block;
  margin: 0;
  color: var(--sl-color-gray-2);
  font-size: 0.875em;
  line-height: 1.5;
  overflow-wrap: anywhere;
  font-weight: 400;
}

.mixedbread__result-page {
  line-height: 1.4;
}

.mixedbread__result-nested {
  position: relative;
  padding-inline-start: 48px;
  padding-inline-end: 16px;
  padding-block: 8px;
}

.mixedbread__result-nested::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 8px;
  width: 32px;
  background: var(--sl-color-gray-4);
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' viewBox='0 0 16 1000' preserveAspectRatio='xMinYMin slice'%3E%3Cpath d='M8 0v1000m6-988H8'/%3E%3C/svg%3E")
    0% 0% / 100% no-repeat;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' viewBox='0 0 16 1000' preserveAspectRatio='xMinYMin slice'%3E%3Cpath d='M8 0v1000m6-988H8'/%3E%3C/svg%3E")
    0% 0% / 100% no-repeat;
}

.mixedbread__result-nested:last-of-type::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 16 16'%3E%3Cpath d='M8 0v12m6 0H8'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 16 16'%3E%3Cpath d='M8 0v12m6 0H8'/%3E%3C/svg%3E");
}

.mixedbread__result-nested > .mixedbread__result-title {
  font-size: 0.9em;
}

.mixedbread-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--mixedbread-border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--mixedbread-text-muted);
}

.mixedbread-powered-by {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.mixedbread-powered-by__logo {
  height: 20px;
  width: 20px;
}

.mixedbread-powered-by a {
  color: var(--sl-color-accent-high);
  text-decoration: underline;
}

.mixedbread-shortcuts {
  display: flex;
  gap: 12px;
  align-items: center;
}

.mixedbread-key {
  background: var(--sl-color-gray-6);
  border: 1px solid var(--sl-color-gray-5);
  border-radius: 0.25rem;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--sl-color-gray-1);
  min-width: 27px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-family: inherit;
}

.mixedbread-no-results,
.mixedbread-loading,
.mixedbread-error,
.mixedbread-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--sl-color-gray-3);
}

.mixedbread-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mixedbread-empty {
  padding: 80px 24px;
}

.mixedbread-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.3;
}

.mixedbread-empty-text {
  font-size: 14px;
  line-height: 1.6;
}

.mixedbread-loading::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--sl-color-gray-5);
  border-top-color: var(--sl-color-accent-high);
  border-radius: 50%;
  animation: mixedbread-spin 0.8s linear infinite;
  margin: 0;
}

@keyframes mixedbread-spin {
  to {
    transform: rotate(360deg);
  }
}

.mixedbread-error {
  color: #ef4444;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mixedbread-error svg {
  width: 24px;
  height: 24px;
  opacity: 0.7;
}

@media (max-width: 640px) {
  .mixedbread-modal {
    padding: 0;
  }

  .mixedbread-modal-container {
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }

  .mixedbread-searchbox input {
    font-size: 16px;
  }

  .mixedbread-footer {
    flex-direction: column;
    gap: 8px;
    align-items: center;
  }

  .mixedbread-powered-by {
    order: 2;
  }

  .mixedbread-shortcuts {
    order: 1;
  }

  .mixedbread-close {
    display: flex;
  }

  .mixedbread-footer a {
    color: var(--sl-color-accent-high);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
